//
//  SNSummaryInfoCell.m
//  ZhuoxinAgriculture
//
//  Created by stone on 16/12/28.
//  Copyright © 2016年 stone. All rights reserved.
//

#import "SNPesticideInformationCell.h"
#import "IQUIView+IQKeyboardToolbar.h"
@interface SNPesticideInformationCell()
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;

@property (weak, nonatomic) IBOutlet UILabel *importanceLabel;

@end
@implementation SNPesticideInformationCell

//- (instancetype)initWithCoder:(NSCoder *)coder
//{
//    self = [super initWithCoder:coder];
//    if (self) {
//        [self addObserver];
//    }
//    return self;
//}
//- (void)dealloc {
//    [[NSNotificationCenter defaultCenter] removeObserver:self];
//}
//- (void)receivedUITextFieldTextDidChangeNotification:(NSNotification *)notify
//{
//    
//}
//- (void)addObserver
//{
//    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receivedUITextFieldTextDidChangeNotification:) name:UITextFieldTextDidChangeNotification object:nil];
//    /*
//     
//     */
//}

-(void)setProductionPlanListPestlist:(SNProductionPlanListPestlist *)productionPlanListPestlist{
    _productionPlanListPestlist = productionPlanListPestlist;
}

- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [super initWithCoder:coder];
    if (self) {
        self.contentView.backgroundColor = HexRGB(0xffffff);
    }
    return self;
}
- (void)doneAction:(id)sender
{
    [self.rightTextField resignFirstResponder];
}
- (void)cancelAction:(id)sender
{
    [self.rightTextField resignFirstResponder];
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
        [self.rightTextField addLeftRightOnKeyboardWithTarget:self leftButtonTitle:@"取消" rightButtonTitle:@"确定" leftButtonAction:@selector(cancelAction:) rightButtonAction:@selector(doneAction:) shouldShowPlaceholder:YES];
}

- (void)configCellWithIndexPath:(NSIndexPath *)indexPath productionPlanListPestlist:(SNProductionPlanListPestlist *)productionPlanListPestlist
{
    _productionPlanListPestlist = productionPlanListPestlist;
    /*
     typedef NS_ENUM(NSInteger, UIKeyboardType) {
     UIKeyboardTypeDefault,                // Default type for the current input method.
     UIKeyboardTypeASCIICapable,           // Displays a keyboard which can enter ASCII characters
     UIKeyboardTypeNumbersAndPunctuation,  // Numbers and assorted punctuation.
     UIKeyboardTypeURL,                    // A type optimized for URL entry (shows . / .com prominently).
     UIKeyboardTypeNumberPad,              // A number pad with locale-appropriate digits (0-9, ۰-۹, ०-९, etc.). Suitable for PIN entry.
     UIKeyboardTypePhonePad,               // A phone pad (1-9, *, 0, #, with letters under the numbers).
     UIKeyboardTypeNamePhonePad,           // A type optimized for entering a person's name or phone number.
     UIKeyboardTypeEmailAddress,           // A type optimized for multiple email address entry (shows space @ . prominently).
     UIKeyboardTypeDecimalPad NS_ENUM_AVAILABLE_IOS(4_1),   // A number pad with a decimal point.
     UIKeyboardTypeTwitter NS_ENUM_AVAILABLE_IOS(5_0),      // A type optimized for twitter text entry (easy access to @ #)
     UIKeyboardTypeWebSearch NS_ENUM_AVAILABLE_IOS(7_0),    // A default keyboard type with URL-oriented addition (shows space . prominently).
     UIKeyboardTypeASCIICapableNumberPad NS_ENUM_AVAILABLE_IOS(10_0), // A number pad (0-9) that will always be ASCII digits.
     
     UIKeyboardTypeAlphabet = UIKeyboardTypeASCIICapable, // Deprecated
     
     };
     */
    switch (indexPath.section) {
        case 0:
            self.titleLabel.text = @"农药种类";
            self.rightTextField.placeholder = @"手动输入";
            self.rightTextField.text = productionPlanListPestlist.pestTypes;
            self.importanceLabel.hidden = YES;
            self.rightTextField.keyboardType = UIKeyboardTypeDefault;
            break;
        case 1:
            self.titleLabel.text = @"农药总量";
            self.rightTextField.placeholder = @"升";
            self.rightTextField.text = productionPlanListPestlist.pestTotal;
            self.importanceLabel.hidden = YES;
            self.rightTextField.keyboardType = UIKeyboardTypeDecimalPad;
            break;
        case 2:
            self.titleLabel.text = @"品牌";
            self.rightTextField.placeholder = @"手动输入";
            self.rightTextField.text = productionPlanListPestlist.pestBrand;
            self.importanceLabel.hidden = YES;
            self.rightTextField.keyboardType = UIKeyboardTypeDefault;
            break;
        case 3:
            self.titleLabel.text = @"厂家";

            self.rightTextField.placeholder = @"手动输入";
            self.rightTextField.text = productionPlanListPestlist.pestManu;
            self.importanceLabel.hidden = YES;
            self.rightTextField.keyboardType = UIKeyboardTypeDefault;
            break;
        case 4:
            self.titleLabel.text = @"价格";
            self.rightTextField.placeholder = @"元/公顷";
            self.rightTextField.text = productionPlanListPestlist.pestPrice;
            self.importanceLabel.hidden = YES;
            self.rightTextField.keyboardType = UIKeyboardTypeDecimalPad;
            break;
        default:
            break;
    }
}

@end
